//
//  GenerateQuestions.swift
//  CrseAsst
//
//  Created by 申铭 on 2024/3/5.
//

import Foundation

public enum MemoryItem: String, CaseIterable {
    case idiom = "记忆一"
    case phrase = "记忆二"
    case problemsAndSolutions = "记忆三"
}

public enum CalcType: String, CaseIterable {
    case twoDigitAdd = "计算一"
    case twoDigitSub = "计算二"
    case threeDigitSdd = "计算三"
    case threeDigitSub = "计算四"
}

class GenerateQuestions {
    func generateQues(type: CalcType) -> [BaseQuestion] {
        switch type {
        case .twoDigitAdd:
            return twoDigitAddData()
        case .twoDigitSub:
            return [BaseQuestion]()
        case .threeDigitSdd:
            return [BaseQuestion]()
        case .threeDigitSub:
            return [BaseQuestion]()
        }
    }
    
    /// 两位数加法
    func twoDigitAddData() -> [CalcQuestion] {
        var ques = [CalcQuestion]()
        for _ in 0...9 {
            let num1 = (11...100).random
            let num2 = (11...100).random
            
            let topic = CalcQuestion()
            topic.num1 = num1
            topic.num2 = num2
            topic.symbol = .add
            
            ques.append(topic)
        }
        
        return ques
    }
}
